package pers.lls;

import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

/**
 * 即时通信服务启动类
 *
 * @author lihuan
 * @version V1.0 创建时间：2019/7/3 17:52
 * Copyright 2019 by landray & STIC
 */
@MapperScan("pers.lls.im.dao.mapper")
@EnableSwagger2
@SpringBootApplication
@EnableCaching
public class ImApplication {

    public static void main(String[] args) {

        SpringApplication.run(ImApplication.class, args);
    }

    @Bean
    public Docket dispatchApi() {
        ApiInfoBuilder apiInfoBuilder = new ApiInfoBuilder();
        ApiInfo apiInfo = apiInfoBuilder.title("IM服务")
                .description("IM服务")
                .version("1.0")
                .contact(new Contact("李醴茝", "", "SmartShuShu@163.com"))
                .build();
        return new Docket(DocumentationType.SWAGGER_2)
                .apiInfo(apiInfo)
                .select().apis(RequestHandlerSelectors.basePackage("pers.lls.im.controller"))
                .build();
    }

}
